http = require('https')
qs = require('querystring')
options = process.argv
# shuapiao_Num = +options[2]
cur_time = new Date().getTime()

options = 
  hostname: 'party.xd.com'
  port: 443
  #path: '/s/qclq/500034/12743969' #pg
  path: '/s/qclq/500034/12744699' #pf
  method: 'GET'
  headers:  
    'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_2_1 like Mac OS X) AppleWebKit/602.4.6 (KHTML, like Gecko) Version/10.0 Mobile/14D27 Safari/602.1'
shuapiao = () ->
  console.log 'start'
  req = http.request(options, (res) ->
    console.log 'STATUS: ' + res.statusCode
    console.log 'HEADERS: ' + JSON.stringify(res.headers)
    # console.log res.headers
    res.setEncoding 'utf8'
    # shuapiao()
    res.on 'data', (chunk) ->
      # chunk = JSON.parse chunk
      console.log chunk
      setTimeout(()->
        shuapiao();
      ,500)
    return
  )
  req.on 'error', (e) ->
    console.log 'problem with request: ' + e.message
    return
  req.end()
shuapiao()